import React, {Component} from 'react'
import Dimensions from 'react-dimensions'
import {fetchData} from '../../components/AjaxConsumer'
import { AutoComplete,
    Modal,
    Button,
    Input,
    Select,
    InputNumber,
    Upload,
    Form,
    Row,
    Col,
    Icon,
    Radio,
    notification,
    TreeSelect,
    message,
    DatePicker,
    TimePicker
} from 'antd';
const FormItem = Form.Item;
const Option = Select.Option;
const RadioGroup = Radio.Group;
import moment from 'moment';
// 产品相容
class CompatibleForm extends React.Component {
    constructor(props) {
        super(props);
        //是否允许表单提交的flag变量
        this.submitFlag = true;
        this.state = {
            showFlag:false,
            formValues: {
                inputValue: '123456'
            },
            //每个输入框校验样式flag
            validateStatusInput: '',
        };
    }

    //表单提交
    handleSubmit = () => {
        alert('提交');
    }

    handResetForm = () => {
        alert('重置');
    }

    handCancle = () => {
        this.props.hiddenModal();
    }

    addHandle2 =() =>{
        alert('show');
        // this.setState({
        //     showFlag:true
        // })
    }

    editHandle =() =>{
        alert('edit');
        // this.setState({
        //     showFlag:true
        // })
    }

        //各个输入框的的change事件
    handleInputChange = (e) => {
        console.log('InputChangeValue',e.target.value)
        //校验样式
        // if(e.target.value == '' || e.target.value == null){
        //     this.setState({validateStatusInput:'error'})
        // } else {
        //     this.setState({validateStatusInput:'success'})
        // }
        // this.pushValueInFromValues('inputValue',e.target.value);
    }

    render(){
        const style = {
            backgroundColor: '#fff',
            margin:'0px 15px 10px 5px',
            padding:'20px 10px'
        }

        const {getFieldDecorator} = this.props.form;

        const formItemLayout = {
            labelCol: {
                xs: {span: 24},
                sm: {span: 6}
            },
            wrapperCol: {
                xs: {span: 24},
                sm: {span: 14}
            }
        };

        return (
            <div style={style}>
                <Row>

                    <Col span={12}>
                        <FormItem {...formItemLayout} label="组编码" hasFeedback>
                            {getFieldDecorator('groupCode', {
                                rules: [
                                    {
                                        required: true, message: '请输入组编码!'
                                    }
                                ]
                            })(<Input/>)}
                        </FormItem>
                    </Col>

                </Row>
                <Row >
                    <Col span={2} offset={10}>
                        <Button type='primary' onClick={this.handleSubmit}>确定</Button>
                    </Col>
                    <Col span={2} >
                        <Button type='default' onClick={this.handCancle}>取消</Button>
                    </Col>
                </Row>
            </div>
        );
    }
}
export default Form.create()(CompatibleForm);